# encoding: utf-8
from app.extensions import log
from app import app
from app.modules.apply.resources import autoRecover, getEndApplyList, notifyPlanPm


def recover():
    """
    自动回收机器
    :return:
    """
    log.info('app.modules.common.scheduler.recover start')
    with app.app_context():
        autoRecover()
    log.info('app.modules.common.scheduler.recover end')


def dayOf3Notify():
    """
    3天内过期的项目通知
    :return:
    """
    log.info('app.modules.common.scheduler.dayOf3Notify start')
    with app.app_context():
        _list = getEndApplyList(_day = 3)
        notifyPlanPm(_list)
    log.info('app.modules.common.scheduler.dayOf3Notify end')


def dayOf7Notify():
    """
    7天内过期的项目通知
    :return:
    """
    log.info('app.modules.common.scheduler.dayOf7Notify start')
    with app.app_context():
        _list = getEndApplyList()
        notifyPlanPm(_list)
    log.info('app.modules.common.scheduler.dayOf7Notify end')
